package llvmast;



public  class LlvmIcmp extends LlvmInstruction{
    LlvmRegister lhs;
    String cmp;
    public LlvmType type;
    public LlvmValue op1, op2;
    
	public static final int EQUAL = 0;
	public static final int GT = 1;
	public static final int GE = 2;
	public static final int LT = 3;
	public static final int LE = 4;
    
    public LlvmIcmp(LlvmRegister lhs,  int conditionCode, LlvmType type, LlvmValue op1, LlvmValue op2){
		this.lhs = lhs;
		this.type = type;
		this.op1 = op1;
		this.op2 = op2;
		if(conditionCode == EQUAL) cmp = "eq";
		if(conditionCode == GT) cmp = "sgt";
		if(conditionCode == GE) cmp = "sge";
		if(conditionCode == LT) cmp = "slt";
		if(conditionCode == LE) cmp = "sle";		
    }
    public String toString(){		
		return "  " + lhs + " = icmp " + cmp + " " + type + " " + op1 + ", " + op2;
    }
}
